home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-20
/
rs0422.zip
/
LEVEL1
/
DUMPRAM.AS
< prev
next >
Wrap
Text File
|
1989-12-28
|
3KB
|
133 lines
ASYD EQU 0DEh ;SIO data port
ASYC EQU 0DFh ;SIO control port
psect text,pure
start: DI ;NO INTS EVER!!!
LD HL,80F0h ;Use the end of IPAGE for Stack
LD SP,HL ;DON'T USE MUCH!!!
; Init SIO
LD HL,SIOAI ;SIO init data pointer
LD B,SIOAIL ;Length of init data
LD C,ASYC ;SIO control port
OTIR ;Init the SIO (rx mode)
AGAIN: LD HL,BANNER ;Identify ourselves
CALL PUTSTR ;Print it!
CALL GETCR ;Wait for a CR
LD HL,8000h ;Start dumping RAM at 8000h
LOOP: LD A,H
OR L ;Are we done?
JP Z,AGAIN ;Yup, let them do it again...
CALL INTEL ;Output a single Intel Hex line
JP LOOP
PUTCH: IN A,(ASYC) ;RR0
AND 4 ;TBE?
JP Z,PUTCH
LD A,B
OUT (ASYD),A
RET
PUTHEX: LD A,D
AND 0F0h ;High Nibble First
SRL A
SRL A
SRL A
SRL A
ADD A,30h
CP 3Ah ;Greater than 9?
JP M,HEX1
ADD A,7 ;Yes, Make it a letter
HEX1: LD B,A
CALL PUTCH
LD A,D
AND 0Fh ;Low Nibble Next
ADD A,30h
CP 3Ah ;Greater than 9?
JP M,HEX2
ADD A,7 ;Yes, Make it a letter
HEX2: LD B,A
CALL PUTCH
RET
PUTSTR: LD A,(HL) ;Get the next char
OR A ;NULL?
RET Z
INC HL ;Advance to next byte
LD B,A
CALL PUTCH ;Send it when we can
JP PUTSTR
GETCR: IN A,(ASYC) ;RR0
AND 1 ;RBF?
JP Z,GETCR
IN A,(ASYD) ;Get the Character
AND 7Fh ;Strip parity
CP 0Dh ;Is it a CR?
RET Z
LD B,07h ;NO, Bitch!
CALL PUTCH
JP GETCR
INTEL: LD A,32 ;Init checksum
ADD A,H
ADD A,L
LD C,A ;Save in right place
LD B,3Ah ;":"
CALL PUTCH
LD D,20h
CALL PUTHEX
LD D,H
CALL PUTHEX
LD D,L
CALL PUTHEX
LD D,00h ;Record type 0 - Data
CALL PUTHEX
ILOOP: LD D,(HL)
INC HL ;Get next byte and Advance pointer
LD A,C
ADD A,D
LD C,A ;Update checksum
CALL PUTHEX
LD A,1Fh
AND L ;Are we done with this line?
JP NZ,ILOOP ;Nope, Keep going...
LD A,C
NEG ;2 Comp Checksum (in A)
LD D,A
CALL PUTHEX
LD B,0Dh ;CR
CALL PUTCH
LD B,0Ah ;LF
CALL PUTCH
RET
psect data
BANNER: defb 0dh,0ah
defm 'ROSE X.25 Packet Switch RAM Dump Utility '
defm 'by Thomas A. Moulton, W2VY'
defb 0dh,0ah,0dh,0ah
defm 'There is NO flow control of any kind!'
defb 0dh,0ah
defm 'You may need to use 4800 baud or less.'
defb 0dh,0ah
defm 'Open ASCII Capture file and hit RETURN when ready.'
defb 0dh,0ah,0dh,0ah,0
; SIO ASYNC initialization block.
SIOAI: DEFB 18H ;Reset SIO
DEFB 14h ;WR 4 + Reset Ext Intr
DEFB 44H ;16xClk + 1Stop
DEFB 3 ;WR 3
DEFB 0C1H ;8bit + RxEnable
DEFB 5 ;WR 5
DEFB 0EAH ;DTR ON + 8bit + TxEnable + RTS On
DEFB 11h ;WR 1 + Reset Ext intr
DEFB 0 ;Disbale all ints
SIOAIL EQU $-SIOAI